import request from '@/utils/request'

// 首页查询文章列表
export function advertised(data) {
  return request({
    url: '/cms/advertised/insert',
    method: 'post',
    /*headers: {
      isToken: false
    },*/
    data: data,
    timeout: 40000
  })
}

// 更新广告列表
export function updateAdvertised(data) {
  return request({
    url: '/cms/advertised/update',
    method: 'post',
    data: data,
    timeout: 40000
  })
}

export function mode() {
  return request({
    url: '/cms/mode',
    method: 'get',
    timeout: 40000
  })
}

export function topList(data) {
  console.log(data)
  return request({
    url: '/cms/advertised/top',
    method: 'get',
    headers: {
      isToken: false
    },
    params: data,
    timeout: 40000
  })
}

export function list(data) {
  return request({
    url: '/cms/advertised/list',
    method: 'get',
    headers: {
      isToken: false
    },
    params: data,
    timeout: 40000
  })
}

export function listAdvertised(data) {
  return request({
    url: '/cms/advertised/list2',
    method: 'get',
    params: data,
    timeout: 40000
  })
}

/**
 * 充值接口
 *
 * @param data
 * @returns {AxiosPromise}
 */
export function credits(data) {
  return request({
    url: '/system/credits',
    method: 'post',
    data: data,
    timeout: 40000
  })
}

/**
 * 通过美元获取bitcoin数量
 * @param data
 * @returns {AxiosPromise}
 */
export function getBtb(data) {
  return request({
    url: '/system/credits/getBtb',
    method: 'get',
    params: data,
    timeout: 40000
  })
}

export function getById(id) {
  return request({
    url: '/cms/advertised/' + id,
    method: 'get',
    timeout: 40000
  })
}

export function getUpdateById(id) {
  return request({
    url: '/cms/advertised/update/' + id,
    method: 'get',
    timeout: 40000
  })
}

export function update(data) {
  return request({
    url: '/cms/advertised/update',
    method: 'post',
    data: data,
    timeout: 40000
  })
}

export function updateTime(id) {
  return request({
    url: '/cms/advertised/updateTime/' + id,
    method: 'post',
    timeout: 40000
  })
}

export function deleteAd(id) {
  return request({
    url: '/cms/advertised/' + id,
    method: 'delete',
    timeout: 40000
  })
}
